<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>27 浏览器大小重置</title>
</head>
<body>
    <div id="demo"></div>
</body>
</html>
<script src="browser.js" type="text/javascript"></script>
<script>
    var demo = document.getElementById("demo");
    var num = 0;
    window.onresize = resize(function () {
        demo.innerText = "宽："+browserSize().width+"\n高："+browserSize().height;
        num++;
        console.log(num);
    },300);

    function resize(fn, delay) {
        var timer = null;
        return function () {
            clearTimeout(timer);
            timer = setTimeout(fn,delay);
        }
    }

</script>